package ${packageName}.configure;

import com.baomidou.mybatisplus.core.parser.ISqlParser;
import com.baomidou.mybatisplus.extension.parsers.BlockAttackSqlParser;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import java.util.List;
//import java.util.Arrays;
//import java.util.Collections;
//import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author Edgar Deng
 */
@Configuration
public class JupiterWebConfigure {

    /**
     * 注册异步线程池
	   * 如果需要自定义线程池配置 可打开注释
     */
//    @Bean(JupiterConstant.ASYNC_POOL)
//    public ThreadPoolTaskExecutor asyncThreadPoolTaskExecutor() {
//        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
//        executor.setCorePoolSize(5);
//        executor.setMaxPoolSize(20);
//        executor.setQueueCapacity(100);
//        executor.setKeepAliveSeconds(30);
//        executor.setThreadNamePrefix("Jupiter-Async-Thread");
//        executor.setWaitForTasksToCompleteOnShutdown(true);
//        executor.setAwaitTerminationSeconds(60);
//        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
//        executor.initialize();
//        return executor;
//    }

    /**
     * 注册分页插件
     * 如果需要分页 可打开注释
     */
//    @Bean
//    public PaginationInterceptor paginationInterceptor() {
//        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
//        List<ISqlParser> sqlParserList = new ArrayList<>();
//        sqlParserList.add(new BlockAttackSqlParser());
//        paginationInterceptor.setSqlParserList(sqlParserList);
//       return paginationInterceptor;
//    }

}
